let fs = require('fs')

let FXdata = JSON.parse(fs.readFileSync('./fxHTML/FXdata.json'))
// .replace('\\', '').replace("'", '"')
let template = fs.readFileSync('./fxHTML/template').toString()

const cheerio = require('cheerio');


let ele = FXdata[15]
const $ = cheerio.load(ele.FXdata.replace('\\', '').replace("'", '"'))
const $2 = cheerio.load(template)

$('head').append($2.html())
$('head').append(`<title>${ele.nameCN_F} / ${ele.nameEN}</title>`)
$('body').append(`<br>&nbsp&nbsp<p>数据来源于 <a href="https://www.yukict.com/bbs/forumdisplay.php?fid=79">YUKI 飛雪之城</a> ，详细资料请参考源网页</p>`)
let num = ele.avatarUrl.split('.png')[0].slice(-5, )
$('img').attr('src', `http://cdn.sdplayer.club/FX/img/${num}.png`)

fs.writeFileSync(__dirname + `/${num}.html`, $.html())